package application.backstage;

import javafx.concurrent.Service;
import javafx.concurrent.Task;

public class BackStageService<T> extends Service<T> {

    private Runnable runnable;

    public void init(Runnable runnable) {
        this.runnable = runnable;
    }

    @Override
    protected Task<T> createTask() {
        return new Task<T>() {
            @Override
            protected T call() throws Exception {
                BackStageService.this.runnable.run();
                return null;
            }
        };
    }

}
